import React, { useEffect, useState } from 'react'
import http from '../../utils/http'
import { useNavigate } from 'react-router-dom';
import { NavBar, SearchBar } from 'antd-mobile'
function Index() {
    const [value, setValue] = useState('')
    const navigate = useNavigate()
    const [list, setList] = useState({})
    const handleSearch = async (val) => {
        setValue(val)
        const res = await http.get('/api/list/search', { params: { wd: val } })

        console.log('搜索', res);

        const { code, data } = res.data

        if (code === 200) {
            setList(data)
        }

    }

    return (
        <div>
            <NavBar onBack={() => navigate(-1)}>搜索页</NavBar>
            <SearchBar placeholder='请输入内容' value={value} onChange={handleSearch} />

        </div>
    )
}

export default Index
